/**
 * 
 */
package com.dsteiner.widgets.client.model;

import java.beans.PropertyChangeListener;

import com.dsteiner.widgets.client.ObjectUtil;
import com.dsteiner.widgets.client.PropertyChangeCollection;
import com.dsteiner.widgets.client.SuggestBoxWidget;
import com.dsteiner.widgets.client.SuggestBoxWidget.Suggestion;

public class SuggestionModel {
	private PropertyChangeCollection propertyChangeSupport = new PropertyChangeCollection(
			this);
	
	public void addPropertyChangeListener(String propertyName,
			PropertyChangeListener listener) {
		propertyChangeSupport.registerPropertyChangeListener(
				propertyName, listener);
	}
	
	private Suggestion suggestion;

	public Suggestion getSuggestion() {
		return suggestion;
	}

	public void setSuggestion(Suggestion suggestion) {
		Suggestion oldSuggestion = this.suggestion;
		this.suggestion = suggestion;
		propertyChangeSupport.firePropertyChange("suggestion", oldSuggestion, suggestion);
	}
	
	private boolean visible = true;

	public boolean isVisible() {
		return visible;
	}

	public void setVisible(boolean visible) {
		boolean oldVisible = this.visible;
		this.visible = visible;
		propertyChangeSupport.firePropertyChange("visible", oldVisible, visible);
	}
}